// pages/FirstPage/FirstPage.js
var app=getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    bt:false,
    yjqflag:1,
    act_modal_list:'show',
    itemData: {},
    price:'0.00',
    address:[],
    // userInfo: {},
    // hasUserInfo: false,
    // canIUse: wx.canIUse('button.open-type.getUserInfo'),
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that=this
    console.log(app.d.store_Id);
     console.log(options);
      console.log('wjp');
        this.setData({
            price:options.price
        })
   wx.request({
      url: app.d.ceshiUrl + '/Api/Index/orderpays',
      method: 'post',
      data: {
        store_Id: (app.d.store_Id ? app.d.store_Id : options.store_Id),
        user_id: app.d.userId,
        order_sn: options.order_sn,
      },
      header: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        console.log(res)
        var store = res.data.store;
        var order = res.data.order;
        console.log(store);
        console.log(order);
           that.setData({
            itemData:store,
            address:order
          })
      },
      fail: function (e) {
        wx.showToast({
          title: '网络不给力！',
          duration: 2000
        });
      },
    })

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  },

  htop:function(){
      wx.navigateTo({
          url: '../index/index'
      });
  },
  seeorder:function(){
     wx.redirectTo({
        url: (app.globalData.froms=='company_user' ? '../user/dingdan?currentTab=1&otype=deliver' : '../user/dingdan?currentTab=1&otype=deliver') ,
     });
  },
  closeActModal: function() {
      this.setData({
            act_modal_list:'a'
        })
  },
  call: function () {
    wx.makePhoneCall({
      phoneNumber: '' + this.data.itemData.tel_id,
      success: function (res) { },
      fail: function (res) { },
      complete: function (res) { },
    })
  },
  handleContact(e) {
    console.log(e.path)
    console.log(e.query)
  },
  onShareAppMessage: function () {
    return {
      title: '' + this.data.itemData.name,
      path: '/pages/FirstPage/FirstPage?store_Id=' + app.d.store_Id+"&f_uid=" + app.d.userId,
      imageUrl: '' + this.data.itemData.logo,
      success: function (res) {
        // 分享成功
      },
      fail: function (res) {
        // 分享失败
      }
    }
  },

})